package com.svs.quartz.util;

import java.util.Date;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.svs.common.support.Convert;
import com.svs.common.utils.DateUtils;

public class JdbcMapUtil {
	
	static Logger logger = LoggerFactory.getLogger(JdbcMapUtil.class) ;

	public static Object getKey(Map<String,Object> map ,String key) {
		Object result = null ;
		try {
			result = map.get(key) ;
			if(null != result ) {
				if(result instanceof Date ) {
					result = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.parseDate(result)) ;
				}
				if(result instanceof Integer ) {
					result = Convert.toInt(result, 0) ;
				}
				if(result instanceof Long ) {
					result = Convert.toLong(result) ;
				}
			}
		} catch (Exception e) {
			logger.error("trans data error ====="+e.getMessage());
		}
		return result ;
	}
}
